//
//  ZJphone.m
//  ZiJinLian
//
//  Created by lzy on 2017/3/10.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "ZJphone.h"

@implementation ZJphone
-(id)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        self.backgroundColor=RGB(246, 246, 246);
        
        [self addSubview:self.phoneLab];
        [self addSubview:self.phoneTF];
        [self addSubview:self.inviteLab];
        [self addSubview:self.inviteTF];
        [self addSubview:self.nextBtn];
        [self addSubview:self.inviteLable];
        

    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    [self layout];
}
#pragma -----------适配UI-----
-(void)layout
{
    
    [self.phoneTF makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.phoneLab.top).offset(0);
        make.right.equalTo(self.phoneLab.right).offset(0);
        make.bottom.equalTo(self.phoneLab.bottom).offset(0);
        make.left.equalTo(self.phoneLab.left).offset(80);
    }];
    [self.inviteTF makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.inviteLab.top).offset(0);
        make.right.equalTo(self.inviteLab.right).offset(0);
        make.bottom.equalTo(self.inviteLab.bottom).offset(0);
        make.left.equalTo(self.inviteLab.left).offset(80);
    }];
    [self.nextBtn makeConstraints:^(MASConstraintMaker *make) {
        //make.centerX.equalTo(self.view);
        make.left.equalTo(self.left).offset(10);
        make.right.equalTo(self.right).offset(-10);
        make.top.equalTo(self.inviteLable.bottom).offset(20);
        make.height.equalTo(98/2);
    }];
}

-(UILabel *)phoneLab
{
    if (!_phoneLab) {
        _phoneLab=[MYUI createLableFrame:CGRectMake(10, 30, MainW-20, 98/2) backgroundColor:[UIColor whiteColor] text:MyString(@"手机号") textColor:[UIColor colorWithHexString:@"#333333"] font:FontAndStyle14 numberOfLines:0 adjustsFontSizeToFitWidth:YES insert:UIEdgeInsetsMake(0, 15, 0, 0)];
        _phoneLab.layer.cornerRadius=5;
        _phoneLab.layer.masksToBounds=YES;
        
    }
    return _phoneLab;
}

-(UITextField *)phoneTF
{
    if (!_phoneTF) {
        _phoneTF=[MYUI createTextFieldFrame:CGRectMake(0,0,0,0) backgroundColor:[UIColor whiteColor] placeholder:MyString(@"请输入手机号码") clearsOnBeginEditing:NO];
        _phoneTF.keyboardType=UIKeyboardTypeNumberPad;
    }
    return _phoneTF;
}
-(UILabel *)inviteLab
{
    if (!_inviteLab) {
        _inviteLab=[MYUI createLableFrame:CGRectMake(10, 90, MainW-20, 98/2) backgroundColor:[UIColor whiteColor] text:MyString(@"邀请码") textColor:[UIColor colorWithHexString:@"#333333"] font:FontAndStyle14 numberOfLines:0 adjustsFontSizeToFitWidth:YES insert:UIEdgeInsetsMake(0, 15, 0, 0)];
        _inviteLab.layer.cornerRadius=5;
        _inviteLab.layer.masksToBounds=YES;
        
    }
    return _inviteLab;
}
-(UILabel *)inviteLable
{
    if (!_inviteLable) {
        _inviteLable=[MYUI createLableFrame:CGRectMake(10, 140, MainW-20, 30) backgroundColor:[UIColor clearColor] text:MyString(@"邀请备注") textColor:Red_Color font:FontAndStyle12 numberOfLines:0 adjustsFontSizeToFitWidth:YES insert:UIEdgeInsetsMake(0, 15, 0, 0)];
        _inviteLable.layer.cornerRadius=5;
        _inviteLable.layer.masksToBounds=YES;
        
    }
    return _inviteLable;
}

-(UITextField *)inviteTF
{
    if (!_inviteTF) {
        _inviteTF=[MYUI createTextFieldFrame:CGRectMake(0,0,0,0) backgroundColor:[UIColor whiteColor] placeholder:MyString(@"请输入邀请码(可不填)") clearsOnBeginEditing:NO];
        _inviteTF.keyboardType=UIKeyboardTypeDefault;
    }
    return _inviteTF;
}

//灰色 [UIColor colorWithRed:228.0/255.0 green:229.0/255.0 blue:230.0/255.0 alpha:1]
//红色[UIColor colorWithRed:204.0/255.0 green:8.0/255.0 blue:20.0/255.0 alpha:1]

-(UIButton *)nextBtn{
    if (!_nextBtn) {
        
        _nextBtn=[MYUI creatButtonFrame:CGRectMake(0,0,0,0) backgroundColor:button_gray_Color setTitle:@"下一步" setTitleColor:Btn_TxTGray_Color ];
        _nextBtn.layer.cornerRadius=5;
        _nextBtn.layer.masksToBounds=YES;
        _nextBtn.titleLabel.font=FontAndStyle15;
        
    }
    return _nextBtn;
}



@end
